From e718893611646528cf0eb730c453e4e73b1a0a47 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 20 Jan 2009 23:58:22 +0100 Subject: [PATCH] Fix performance issue with find_native_sibling_above It keep recursing a lot, unnecessary --- gdk/gdkwindow.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 8da989c77d..fedf32afc2 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -693,8 +693,8 @@ _gdk_window_update_size (GdkWindow *window) * If child is NULL, find lowest native window in parent. */ static GdkWindowObject * -find_native_sibling_above (GdkWindowObject *parent, - GdkWindowObject *child) +find_native_sibling_above_helper (GdkWindowObject *parent, + GdkWindowObject *child) { GdkWindowObject *w; GList *l; @@ -714,12 +714,27 @@ find_native_sibling_above (GdkWindowObject *parent, if (gdk_window_has_impl (w)) return w; - - w = find_native_sibling_above (w, NULL); + + g_assert (parent != w); + w = find_native_sibling_above_helper (w, NULL); if (w) return w; } + return NULL; +} + + +static GdkWindowObject * +find_native_sibling_above (GdkWindowObject *parent, + GdkWindowObject *child) +{ + GdkWindowObject *w; + + w = find_native_sibling_above_helper (parent, child); + if (w) + return w; + if (gdk_window_has_impl (parent)) return NULL; else -- 2.30.2